package net.esj.basic.dao.ann.component.table;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import net.esj.basic.dao.ann.component.Container;
import net.esj.basic.dao.ann.component.column.AbstractColumn;
import net.esj.basic.dao.ann.component.column.PrimaryKey;

public abstract class AbstractTable {
	
	private Container container;

	private String tableName;
	
	private PrimaryKey primaryKey; 
	
	private Map<String,AbstractColumn> columns;
	
	public AbstractTable(Container container, String tableName) {
		super();
		this.container = container;
		this.tableName = tableName;
		this.columns = new HashMap<String, AbstractColumn>();
	}

	public AbstractTable(Container container,String tableName,
			Map<String,AbstractColumn> fields) {
		super();
		this.tableName = tableName;
		this.columns = fields;
		this.container = container;
	}

	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public Map<String, AbstractColumn> getColumns() {
		return columns;
	}

	public void setColumns(Map<String, AbstractColumn> fields) {
		this.columns = fields;
	}

	public Container getContainer() {
		return container;
	}

	public void setContainer(Container container) {
		this.container = container;
	}

	public PrimaryKey getPrimaryKey() {
		return primaryKey;
	}

	public void setPrimaryKey(PrimaryKey primaryKey) {
		this.primaryKey = primaryKey;
	}
	
	public void notifyColumn(AbstractColumn column){
		columns.put(column.getColumnName(), column);
	}
}
